<template>
  <el-form ref="form" :model="form" label-position="" label-width="">
    <div class="grapInstove">
        <div class="card-table">
            <div class="header">
                <div @click="$router.go(-1)" class="goBackIcon">
                    <i class="el-icon-arrow-left" style="margin-right:1px;"></i>
                    <span>返回</span>
                </div>
                <div style="flex:1;margin-right:50px;text-align:center;"><span style="font-size:26px;">石墨化装(出)炉报告单</span><span style="margin-left:24px;">{{getCode}}</span></div>
            </div>
            <el-table
                @cell-click="cellClick(...arguments, 'userRequire')"
                cell-class-name="cellClassName"
                :row-class-name="tableRowClassName"
                :header-cell-style="getRowClass"
                :data="form.userRequire"
                style="width: 100%">
                <el-table-column
                    header-align="center"
                    align="center"
                    label="用户质量要求" >
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        show-overflow-tooltip
                        label="加工单位" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.processUnit"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.processUnit}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        show-overflow-tooltip
                        label="种类" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.type"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.type}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="规格型号" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.specification"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.specification}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="数量（支）" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                type="number"
                                v-model.number="row.number"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.number===0?null:row.number}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="根合格率（%）" >
                        <template slot-scope="{row, column, $index}">
                            <el-input-number
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                class="tableInput"
                                v-focus
                                :controls='false'
                                @blur="tabClickIndex = null"
                                v-model="row.qualifiedRate" >
                            </el-input-number>
                            <!-- <el-input
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.qualifiedRate"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input> -->
                            <div v-else class="tableSpan">{{row.qualifiedRate}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="来料焙烧品电阻率" >
                        <template slot-scope="{row, column, $index}">
                            <el-input-number
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                class="tableInput"
                                v-focus
                                :controls='false'
                                @blur="tabClickIndex = null"
                                v-model="row.incomingResistivityLess" >
                            </el-input-number>
                            <!-- <el-input
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                clearable
                                class="tableInput"
                                v-focus
                                v-model="row.incomingResistivityLess"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input> -->
                            <div v-else class="tableSpan">{{row.incomingResistivityLess}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="实际抽测焙烧品电阻率范围值" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.actualResistivityRange"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.actualResistivityRange}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="合同要求石墨化后电阻率≤" >
                        <template slot-scope="{row, column, $index}">
                            <el-input-number
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                class="tableInput"
                                v-focus
                                :controls='false'
                                @blur="tabClickIndex = null"
                                v-model="row.contractResistivityLess" >
                            </el-input-number>
                            <!-- <el-input
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.contractResistivityLess"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input> -->
                            <div v-else class="tableSpan">{{row.contractResistivityLess}}</div>
                        </template>
                    </el-table-column>
                </el-table-column>
                <el-table-column
                    header-align="center"
                    align="center"
                    prop="prop">
                    <template slot="header" slot-scope="/* eslint-disable vue/no-unused-vars */ scope">
                        <div style="display:flex;align-items:center;">
                            <div style="">外协负责人：</div>
                            <div class="">
                                <el-input :class="outStove||detial?'disableInput':''" style="width:150px;" size="small" v-model="form.outHelpPrincipal" placeholder="请输入内容"></el-input>
                            </div>
                        </div>
                    </template>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        width="300"
                        show-overflow-tooltip
                        label="备注" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'userRequire'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.remark"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.remark}}</div>
                        </template>
                    </el-table-column>
                </el-table-column>
            </el-table>
        </div>
        <div class="card-table">
            <el-table
                @cell-click="cellClick(...arguments, 'stoveReport')"
                :row-class-name="tableRowClassName"
                :header-cell-style="getRowClass"
                cell-class-name="cellClassName"
                :data="form.stoveReport"
                style="width: 100%">
                <el-table-column
                    header-align="center"
                    align="center"
                    prop="prop"
                    label="label" >
                    <template slot="header" slot-scope="/* eslint-disable vue/no-unused-vars */ scope">
                        <el-form-item label="炉号:" prop="stoveCode" required>
                            <el-input :class="outStove||detial?'disableInput':''" style="width:150px;" size="small" v-model="form.stoveCode" placeholder="请输入内容"></el-input>
                        </el-form-item>
                    </template>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        show-overflow-tooltip
                        label="加工单位" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'stoveReport'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.processUnit"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.processUnit}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="种类" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'stoveReport'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.type"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.type}}</div>
                        </template>
                    </el-table-column>
                </el-table-column>
                <el-table-column
                    header-align="center"
                    align="center"
                    label="装炉报告" >
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="规格型号" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'stoveReport'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.specification"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.specification}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="数量（支）" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'stoveReport'===tabClickIndex"
                                clearable
                                class="tableInput"
                                v-focus
                                type="number"
                                v-model.number="row.number"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.number===0?null:row.number}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="长度" >
                        <template slot-scope="{row, column, $index}">
                            <el-input-number
                                v-if="$index+column.label+'stoveReport'===tabClickIndex"
                                class="tableInput"
                                v-focus
                                :controls='false'
                                @blur="tabClickIndex = null"
                                v-model="row.length" >
                            </el-input-number>
                            <div v-else class="tableSpan">{{row.length===0?null:row.length}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="单重T" >
                        <template slot-scope="{row, column, $index}">
                            <el-input-number
                                v-if="$index+column.label+'stoveReport'===tabClickIndex"
                                class="tableInput"
                                v-focus
                                :controls='false'
                                @blur="tabClickIndex = null"
                                v-model="row.singleWeight" >
                            </el-input-number>
                            <div v-else class="tableSpan">{{row.singleWeight===0?null:row.singleWeight}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="weight"
                        label="重量T" >
                        <template slot-scope="{row, column, $index}">
                            <el-input-number
                                v-if="$index+column.label+'stoveReport'===tabClickIndex"
                                class="tableInput"
                                v-focus
                                :controls='false'
                                @blur="tabClickIndex = null"
                                v-model="row.weight" >
                            </el-input-number>
                            <div v-else class="tableSpan">{{row.weight===0?null:row.weight}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        label="复检问题品类型统计" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'stoveReport'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.recheckProblemProduct"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.recheckProblemProduct}}</div>
                        </template>
                    </el-table-column>
                </el-table-column>
                <el-table-column
                    header-align="center"
                    align="center"
                    prop="prop">
                    <template slot="header" slot-scope="/* eslint-disable vue/no-unused-vars */ scope">
                        <div style="display:flex;align-items:center;">
                            <el-form-item label="日期：" prop="stoveTime" required>
                                <el-date-picker
                                    style="width:180px"
                                    :disabled="outStove||detial?true:false"
                                    :class="outStove||detial?'disableInput':''"
                                    v-model="form.stoveTime"
                                    size="small"
                                    type="datetime"
                                    placeholder="选择日期时间"
                                    value-format="yyyy-MM-dd hh:mm:ss">
                                </el-date-picker>
                            </el-form-item>
                        </div>
                    </template>
                    <el-table-column
                        header-align="center"
                        align="center"
                        prop="prop"
                        width="300"
                        show-overflow-tooltip
                        label="备注" >
                        <template slot-scope="{row, column, $index}">
                            <el-input
                                v-if="$index+column.label+'stoveReport'===tabClickIndex"
                                clearable

                                class="tableInput"
                                v-focus
                                v-model="row.remark"
                                @blur="tabClickIndex = null"
                                placeholder="">
                            </el-input>
                            <div v-else class="tableSpan">{{row.remark}}</div>
                        </template>
                    </el-table-column>
                </el-table-column>
                <div slot="append">
                    <el-descriptions :column="5" border>
                        <el-descriptions-item label-class-name="my-label" label="质检员">
                            <el-input :class="outStove||detial?'disableInput':''" class="tableInput" v-model="form.qualityTestMan" placeholder="请输入质检员"></el-input>
                        </el-descriptions-item>
                        <el-descriptions-item label-class-name="my-label" label="装炉支数">
                            <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.totalNumber" ></el-input-number>
                        </el-descriptions-item>
                        <el-descriptions-item label-class-name="my-label" label="保管员">
                            <el-input :class="outStove||detial?'disableInput':''" class="tableInput" v-model="form.storekeeper" placeholder="请输入保管员"></el-input>
                        </el-descriptions-item>
                        <el-descriptions-item label-class-name="my-label isRequire" label="总重">
                            <el-form-item prop="totalWeight" required>
                                <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.totalWeight" ></el-input-number>
                            </el-form-item>
                        </el-descriptions-item>
                        <el-descriptions-item label-class-name="my-label" label="装炉人">
                            <el-input :class="outStove||detial?'disableInput':''" class="tableInput" v-model="form.stoveMan" placeholder="请输入装炉人"></el-input>
                        </el-descriptions-item>
                    </el-descriptions>
                </div>
            </el-table>
        </div>
        <div class="card-table">
            <el-descriptions border :column="6">
                <el-descriptions-item label-class-name="my-label isRequire" label="总第炉数" >
                    <el-form-item prop="electric.totalStoveNum" required>
                        <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.totalStoveNum" ></el-input-number>
                        <!-- <el-input :class="outStove||detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.totalStoveNum" placeholder=""></el-input> -->
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="送电时间" :span="2">
                    <el-form-item prop="electric.startElectricTime" required>
                        <el-date-picker
                        class="tableInput"
                        :disabled="outStove||detial?true:false"
                        :class="outStove||detial?'disableInput':''"
                        v-model="form.electric.startElectricTime"
                        type="datetime"
                        placeholder="选择日期时间"
                        value-format="yyyy-MM-dd hh:mm:ss">
                        </el-date-picker>
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item  :span="3" label-class-name="my-label" label="" >
                    <!-- <el-input :class="outStove||detial?'disableInput':''" type="number" class="tableInput" v-model="form.electric.totalStoveNum" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" v-for="item in form.electric.powerTime" :key="item.name" :label="item.name">
                    <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="item.power" ></el-input-number>
                    <!-- <el-input :class="outStove||detial?'disableInput':''" type="number" class="tableInput" v-model.number="item.power" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="送电开始功率">
                    <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.startPower" ></el-input-number>
                    <!-- <el-input :class="outStove||detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.startPower" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="计划电量">
                    <el-form-item prop="electric.plannedElectricity" required>
                        <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.plannedElectricity" ></el-input-number>
                        <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.plannedElectricity" placeholder=""></el-input> -->
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="装炉柱数">
                    <el-form-item prop="electric.stoveColumnNum" required>
                        <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.stoveColumnNum" ></el-input-number>
                        <!-- <el-input :class="outStove||detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.stoveColumnNum" placeholder=""></el-input> -->
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="单柱串接">
                    <el-form-item prop="electric.oneColumnStrand" required>
                        <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.oneColumnStrand" ></el-input-number>
                        <!-- <el-input :class="outStove||detial?'disableInput':''" class="tableInput" v-model="form.electric.oneColumnStrand" placeholder=""></el-input> -->
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="截面(c㎡)">
                    <el-form-item prop="electric.section" required>
                        <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.section" ></el-input-number>
                        <!-- <el-input :class="outStove||detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.section" placeholder=""></el-input> -->
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="电密(c㎡/A)">
                    <el-form-item prop="electric.denseElectricity" required>
                        <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.denseElectricity" ></el-input-number>
                        <!-- <el-input :class="outStove||detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.denseElectricity" placeholder=""></el-input> -->
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="位移要求<">
                    <el-form-item prop="electric.displacementLess" required>
                        <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.displacementLess" ></el-input-number>
                        <!-- <el-input :class="outStove||detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.displacementLess" placeholder=""></el-input> -->
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="配重">
                    <el-form-item prop="electric.counterweight" required>
                        <el-input-number :class="outStove||detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.counterweight" ></el-input-number>
                        <!-- <el-input :class="outStove||detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.counterweight" placeholder=""></el-input> -->
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="保温料">
                    <el-form-item prop="electric.keepWarmMaterial" required>
                        <el-input :class="outStove||detial?'disableInput':''" class="tableInput" v-model="form.electric.keepWarmMaterial" placeholder=""></el-input>
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="装炉方式">
                    <el-form-item prop="electric.stoveWay" required>
                        <el-input :class="outStove||detial?'disableInput':''" class="tableInput" v-model="form.electric.stoveWay" placeholder=""></el-input>
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="其他说明">
                    <el-input :class="outStove||detial?'disableInput':''" class="tableInput" v-model="form.electric.otherInstructions" placeholder=""></el-input>
                </el-descriptions-item>
            </el-descriptions>
        </div>
        <div v-if="outStove||detial" class="card-table">
            <el-descriptions border :column="5" title="出炉信息">
                <el-descriptions-item label-class-name="my-label" label="送电开始直流电压" >
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.startVoltage" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''"  type="number" class="tableInput" v-model.number="form.electric.startVoltage" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label isRequire" label="停电时间" :span="2">
                    <el-form-item prop="electric.stopElectricTime" required>
                        <el-date-picker
                        class="tableInput"
                        :disabled="detial?true:false"
                        :class="detial?'disableInput':''"
                        v-model="form.electric.stopElectricTime"
                        type="datetime"
                        placeholder="选择日期时间"
                        value-format="yyyy-MM-dd hh:mm:ss">
                        </el-date-picker>
                    </el-form-item>
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="起始炉阻">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.startStoveResistance" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.startStoveResistance" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="停电功率">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.stopPower" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.stopPower" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="停电直流电压">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.stopVoltage" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.stopVoltage" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="平段">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.specialPowerTime[3].power" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.specialPowerTime[3].power" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="尖峰">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.specialPowerTime[0].power" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.specialPowerTime[0].power" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="高峰">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.specialPowerTime[1].power" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.specialPowerTime[1].power" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="谷电">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.specialPowerTime[2].power" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.specialPowerTime[2].power" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="停炉炉阻">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.stopStoveResistance" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.stopStoveResistance" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="实际电量">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.actualElectricity" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.actualElectricity" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="吨耗">
                    <el-input-number :class="detial?'disableInput':''" class="tableInput" :controls='false' v-model="form.electric.tonConsumption" ></el-input-number>
                    <!-- <el-input :class="detial?'disableInput':''" type="number" class="tableInput" v-model.number="form.electric.tonConsumption" placeholder=""></el-input> -->
                </el-descriptions-item>
                <el-descriptions-item label-class-name="my-label" label="备注">
                    <el-input :class="detial?'disableInput':''" class="tableInput" v-model="form.electric.remark" placeholder=""></el-input>
                </el-descriptions-item>
            </el-descriptions>
        </div>
        <div v-if="!detial" class="card-table" style="margin-bottom:100px">
            <el-button icon="el-icon-document-checked" @click="submitForm('form')" type="primary">{{this.outStove?'出 炉':'提 交'}}</el-button>
            <!-- <el-button icon="el-icon-refresh-right" plain type="primary" @click="refresh('form')">重 置</el-button> -->
            <el-button icon="el-icon-document-remove" @click="$router.go(-1)">取 消</el-button>
        </div>
    </div>
  </el-form>
</template>

<script>
import { graphiteReportCreate, graphiteReportUpdate } from '@/api/process.js'
export default {
  name: 'grapInstove',
  components: {},
  data () {
    return {
      people: '',
      outStove: false,
      edit: false,
      detial: false,
      tabClickIndex: null, // 列表当前点击的index
      form: {
        code: '', // 报告单唯一编号
        outStove: '',
        outHelpPrincipal: '', // 外协负责人
        stoveCode: '', // 炉号
        stoveTime: '', // 装炉报告日期
        qualityTestMan: '', // 质检人
        storekeeper: '', // 保管员
        totalWeight: '', // 总重
        stoveMan: '', // 装炉人
        electric: {
          powerTime: [],
          specialPowerTime: [
            {
              name: '尖峰',
              time: ''
            },
            {
              name: '峰电',
              time: ''
            },
            {
              name: '谷电',
              time: ''
            },
            {
              name: '平电',
              time: ''
            }
          ]
        }, // 电
        userRequire: [ // 用户质量要求
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {}
        ],
        stoveReport: [ // 装炉报告详细
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {}
        ]
      }
    }
  },
  computed: {
    getCount () {
      var number = 0
      var weight = 0
      const length = this.form.stoveReport ? this.form.stoveReport.length : 0
      for (let index = 0; index < length; index++) {
        const element = this.form.stoveReport[index]
        number += element.number || 0
        weight += element.weight || 0
      }
      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
      this.form.totalWeight = weight
      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
      this.form.totalNumber = number
      return { number, weight }
    },
    getCode () {
      if (!this.form.electric.startElectricTime) return ''
      var time = this.form.electric.startElectricTime.toString()
      time = time.replace(/-/g, '')
      time = time.replace(/\s/g, '')
      time = time.replace(/:/g, '')
      time = time.slice(0, -4)
      console.log(time)
      const stove = this.form.stoveCode < 10 ? 0 + this.form.stoveCode : this.form.stoveCode
      const code = 'SMH' + time + 'L' + stove
      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
      this.form.code = code
      return code
    }
  },
  created () {
    const query = this.$route.query
    if (query.row) {
      this.form = JSON.parse(query.row)
      this.edit = query.edit
      this.outStove = query.outStove
      this.detial = query.detial
    } else {
      // 初始化一些数组有关数据
      this.form.electric.powerTime = []
      for (let index = 0; index < 24; index++) {
        this.form.electric.powerTime.push({ name: index + 'h', time: '' })
      }
      this.form.electric.powerTime[0].name = '开始'
    }
  },
  mounted () {
  },
  methods: {
    // 修改为number
    // changeNumber (value) {
    //   console.log(value)
    //   value = value.replace(/[^0-9.]/g, '')
    // },
    // 点击表格单元格时触发的方法
    cellClick (row, column, cell, event, table) {
      if (this.outStove || this.detial) {
        this.tabClickIndex = null
      } else {
        this.tabClickIndex = row.index + column.label + table
      }
    },
    tableRowClassName ({ row, rowIndex }) {
      // 把每一行的索引放进row
      row.index = rowIndex
    },
    // 修改表格头样式
    getRowClass ({ row, column, rowIndex, columnIndex }) {
      const blon = rowIndex === 0 || rowIndex === 1
      if (blon) {
        return 'font-weight:200;background-color:#FBFBFF;color:black;'
      } else {
        return ''
      }
    },
    submitForm (formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          if (this.edit) {
            if (this.outStove) { this.form.isOutStove = true }
            graphiteReportUpdate(this.form).then(res => {
              if (res.data.code === 200) {
                this.$router.go(-1)
                this.$message({
                  message: '成功',
                  type: 'success'
                })
              } else {
                this.$message({
                  message: res.data.message,
                  type: 'warning'
                })
              }
              //   console.log(res)
            })
          } else {
            graphiteReportCreate(this.form).then(res => {
              if (res.data.code === 200) {
                this.$router.go(-1)
                this.$message({
                  message: '新增成功',
                  type: 'success'
                })
              } else {
                this.$message({
                  message: res.data.message,
                  type: 'warning'
                })
              }
            })
          }
        } else {
          this.$message({
            message: '请将必填项填写完整！'
          })
          return false
        }
      })
    }
  }
}
</script>
